home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!hpl3sn03.cern.ch
- From: Dan Pop <danpop@mail.cern.ch>
- Newsgroups: comp.lang.c
- Subject: Re: What's wrong here?
- Date: Thu, 1 Feb 1996 02:44:06 +0100
- Organization: CERN European Lab for Particle Physics
- Message-ID: <9602010144.AA23637@dxmint.cern.ch>
- References: <4eml5o$o6h@airdmhor.gen.nz> <310FB5FF.4BE6@microsports.com>
- X-NNTP-Posting-Host: hpl3sn03.cern.ch
- X-Newsreader: NN version 6.5.0 #7 (NOV)
- X-Mail2News-Path: dxmint.cern.ch!hpl3sn03.cern.ch
-
- >> Watcom gives the following warnings (and _only_ those warnings) compiling
- >> the above code (except without the line numbers or colons), but only when
- >> it's compiling it as C++ and generating 32 bit code (GCC doesn't, no matter
- >> how hard I try). I don't know C++ myself, but my flatmate is learning it,
- >> does it have anything to do with the typedef?
- >>
- >> TEST.CPP(12): Warning! W389: (col 15) integral value may be truncated during
- >> assignment or initialization
- >> TEST.CPP(17): Warning! W389: (col 15) integral value may be truncated during
- >> assignment or initialization
- >
- >The typedef doesn't matter.
-
- This is the only sensible statement I could find.
-
- >Try turning off the optimizer (-od). Lines
-
- Why? How can the optimizer be responsible for these spurious warnings?
-
- >12 is where a, b, c are first used and the uncasted numeric constants
- >are being resolved.
-
- Plain nonsense. Constants are _never_ "resolved". The line 12 involves
- only variables.
-
- >Again, at line 17, d is being access (not
- >assigned?!?) for the first time.
-
- Are you blind, idiot or what? The relevant portion of the code looks like
- this:
-
- 9: a = 1;
- 10: b = 2;
- 11: c = 4;
- 12: d = a | b | c;
- 13:
- 14: d |= a;
- 15:
- 16: d |= a | b;
- 17: d = d | a | b;
-
- d is assigned for the first time at line 12 and its value is accessed for
- the first time at line 14, then at line 16.
-
- >You may be able to clear everything up by changing lines 9-11 to:
- > a = (word) 1;
- > b = (word) 2;
- > c = (word) 3;
-
- More blatant nonsense. How are these casts supposed to make _any_
- difference in the way the compiler handles lines 12 and 17???
-
- Dan
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-